<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */


/**
 * Smarty {humandate} function plugin
 *
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_humandate($params, &$smarty)
{
	$today = strtotime('today 0:00');
	if ($today <= $params['starttime']) {
		return date('H:i', $params['starttime']);
	} else {
		$yesterday = strtotime('yesterday 0:00');
		if ($yesterday <= $params['starttime']) {
			return 'včera';
		} else {
			if (date('Y') == date('Y', $params['starttime'])) {
				return date('j.n.', $params['starttime']);
			} else {
				return date('j.n.Y', $params['starttime']);
			}
		}
	}
}
/* vim: set expandtab: */

?>
